module.exports = {
  setCookie: (name, value) => {
    let day = 30
    let exp = new Date()
    exp.setTime(exp.getTime() + day * 24 * 60 * 60 * 1000)
    document.cookie = name + '=' + escape(value) + ';expires=' + exp.toGMTString()
  },
  getCookie: (name) => {
    let array = null
    let reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)')
    array = document.cookie.match(reg)
    if (array) {
      return unescape(array[2])
    } else {
      return null
    }
  }
}
